package algorithm.sort;

/**
 * @author xutao
 * created 2020/3/16 11:05
 * 冒泡排序算法实现
 */
public class BubbleSort implements Sort{

    @Override
    public String name() {
        return "冒泡排序";
    }

    @Override
    public  void sort(Integer[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = i+1; j < arr.length; j++) {
                if (arr[i]>arr[j]){
                    swap(arr,i,j);
                }
            }            
        }
    }
}
